//
//  RigisterViewController.swift
//  DollBuy
//
//  Created by 郑东喜 on 2016/11/22.
//  Copyright © 2016年 郑东喜. All rights reserved.
//

import UIKit

class RigisterViewController: UITableViewController,RigisterDelegate {
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        //隐藏导航栏
        self.navigationController?.navigationBar.isHidden = false
        
        //设置导航栏背景颜色透明
        UIApplication.shared.statusBarStyle = UIStatusBarStyle.default
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        //设置标题
        self.navigationItem.title = "注册"
        
        //修改导航栏背景色
        self.navigationController?.navigationBar.barTintColor =
            UIColor.white
                tableView.separatorStyle = UITableViewCellSeparatorStyle.none
        tableView.backgroundColor = UIColor.gray
        setUI()
    }

}

// MARK:- 设置UI
extension RigisterViewController{
    func setUI() -> Void {
        let rigV = RigisterView()
        
        rigV.frame = view.bounds
        
        rigV.delegate = self
        view.addSubview(rigV)
    }
}

// MARK:- 监听代理
extension RigisterViewController {
    func rigSuccess() {
        
        print("注册成功")
        LoginModel.shared.loginStatus = "true"
        
        self.navigationController!.popToRootViewController(animated: true)
//        self.navigationController?.popToViewController(LoginView(), animated: true)
    }
}
